<%= f.simple_fields_for name, permissions do |ff| %>
  <% if permissions.class.attribute_names_for_inlining.any? %>
    <div class="field">
      <b>
        <input class="select-all-btn" type="checkbox" onclick=selectAllPermission(this)>
        <%= permissions.class.model_name.human %>
      </b>

      <p class="control">

        <% permissions.class.attribute_names_for_inlining.each do |permission| %>
          <%= ff.check_box permission, label: permission, class: 'checkbox', onclick: "checkSelect(this)" %>
          <%= permissions.class.human_attribute_name(permission) %>
        <% end %>
      </p>
    </div>
  <% end %>

  <% permissions.class.attribute_names_for_nesting.each do |permission| %>
    <%= render partial: "permissions", locals: {f: ff, name: permission, permissions: permissions.send(permission)} %>
  <% end %>
<% end %>


